﻿using Emoney.UserTraining.Cache;
using Emoney.UserTraining.Comm;
using Emoney.UserTraining.DAL;
using Emoney.UserTraining.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Emoney.UserTraining.BLL
{
   public  class Web_TrainUserBLL
    {
       public List<Web_TrainUser> GetListByMonth(string username)
       {
           Web_TrainUserQuery query = new Web_TrainUserQuery() { UserName = username };
           Web_TrainUserDAL dal = new Web_TrainUserDAL();

           List<Web_TrainUser> lst = null;
           string key = "mydmtrain_" + username;
           News2CacheTools cache = new News2CacheTools();
           var obj = cache.Get<List<Web_TrainUser>>(key);
           if (obj != null)
           {
               lst = obj;
           }
           else
           {
               lst = dal.GetListByMonth(query);
               cache.Add(key, lst, 0, 0, 20);
           }
           return lst;
       }
    }
}
